package HomeWork;

import java.util.Scanner;

public abstract class Shape {
    abstract void area();
    abstract void perimeter();
}

class Circular extends Shape{
    int r=14;
    @Override
    void  area() {
        double a=Math.pow(r,2)*3.14;
        System.out.println("圆形的面积:"+a);
    }
    @Override
    void  perimeter() {
        double p=2*3.14*r;
        System.out.println("圆形的周长:"+p);
    }
    public static void main(String[] args) {
        Circular circular=new Circular();
        Rectangle rectangle=new Rectangle();
        System.out.println("=======圆形=======");
        circular.area();
        circular.perimeter();
        System.out.println("=======矩形=======");
        rectangle.area();
        rectangle.perimeter();
    }
}

class Rectangle extends Shape {
    Scanner rectangle = new Scanner(System.in);
    int i =10;
    int j =12;

    @Override
    void area() {
        int area = i * j;
        System.out.println("长方形的面积:" + area);
    }

    @Override
    void perimeter() {
        int p = 2 * i + 2 * j;
        System.out.println("长方形的周长:" + p);
    }
}


